package Five;

import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n1 = scan.nextInt();
		int i=0;
		while(i<n1){
			System.out.println(new PersonOverride());
			i++;
		}
		int n2 = scan.nextInt();
		PersonOverride[] person = new PersonOverride[n2];
		i=0;
		while(i<n2){
			PersonOverride p=new PersonOverride(scan.next(), scan.nextInt(), scan.nextBoolean());
			int j=0;
			while(j<i){
				if(person[j].equals(p)){
					n2--;
					break;
				}
				j++;
			}
			if(j==i){
				person[i]=p;
				System.out.println(p.toString());
				i++;
			}
		}		
		System.out.println(n2);
		System.out.println(Arrays.toString(PersonOverride.class.getConstructors()));
		scan.close();
	}
	
}
